<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * Project filter form base class.
 *
 * @package    filters
 * @subpackage Project *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseProjectFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'              => new sfWidgetFormFilterInput(),
      'code'              => new sfWidgetFormFilterInput(),
      'fund_id'           => new sfWidgetFormDoctrineChoice(array('model' => 'Fund', 'add_empty' => true)),
      'contract_type'     => new sfWidgetFormChoice(array('choices' => array('' => '', 'By Admin' => 'By Admin', 'Straight' => 'Straight'))),
      'status'            => new sfWidgetFormChoice(array('choices' => array('' => '', 'Pending' => 'Pending', 'Documentation Complete' => 'Documentation Complete', 'In Progress' => 'In Progress', 'Suspended' => 'Suspended', 'Completed' => 'Completed'))),
      'project_cost'      => new sfWidgetFormFilterInput(),
      'total_bid_amount'  => new sfWidgetFormFilterInput(),
      'computed_overhead' => new sfWidgetFormFilterInput(),
      'days_to_complete'  => new sfWidgetFormFilterInput(),
      'start_date'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'end_date'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'publication'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'pow'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'bidding'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'abstract'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'notice_of_award'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'contracts'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'notice_to_proceed' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'dv_no'             => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'name'              => new sfValidatorPass(array('required' => false)),
      'code'              => new sfValidatorPass(array('required' => false)),
      'fund_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Fund', 'column' => 'id')),
      'contract_type'     => new sfValidatorChoice(array('required' => false, 'choices' => array('By Admin' => 'By Admin', 'Straight' => 'Straight'))),
      'status'            => new sfValidatorChoice(array('required' => false, 'choices' => array('Pending' => 'Pending', 'Documentation Complete' => 'Documentation Complete', 'In Progress' => 'In Progress', 'Suspended' => 'Suspended', 'Completed' => 'Completed'))),
      'project_cost'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total_bid_amount'  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'computed_overhead' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'days_to_complete'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'start_date'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'end_date'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'publication'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'pow'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'bidding'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'abstract'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'notice_of_award'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'contracts'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'notice_to_proceed' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'dv_no'             => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('project_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Project';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'name'              => 'Text',
      'code'              => 'Text',
      'fund_id'           => 'ForeignKey',
      'contract_type'     => 'Enum',
      'status'            => 'Enum',
      'project_cost'      => 'Number',
      'total_bid_amount'  => 'Number',
      'computed_overhead' => 'Number',
      'days_to_complete'  => 'Number',
      'start_date'        => 'Date',
      'end_date'          => 'Date',
      'publication'       => 'Date',
      'pow'               => 'Date',
      'bidding'           => 'Date',
      'abstract'          => 'Date',
      'notice_of_award'   => 'Date',
      'contracts'         => 'Date',
      'notice_to_proceed' => 'Date',
      'dv_no'             => 'Text',
    );
  }
}